package DCSource;
public class dcsrc {
	public static boolean isWindowsSystem()
	  { String osName = System.getProperty("os.name").toLowerCase();
	    return osName.indexOf("windows") >= 0;
	  }
	  
	public static boolean isLinuxSystem()
	  { String osName = System.getProperty("os.name").toLowerCase();
	    return osName.indexOf("linux") >= 0;
	  }
	public static String getOS(){
		return System.getProperty("os.name").toLowerCase();
	}
	public static boolean isOS(String os){
		{ String osName = System.getProperty("os.name").toLowerCase();
	    return osName.indexOf(os.toLowerCase()) >= 0;
	  }
	}
	public static String getUmschalt(){
		if (isWindowsSystem()==true){
			return String.valueOf((char)13)+String.valueOf((char)10);
		}else{return String.valueOf((char)10);}
	}
	public static int rand(int low, int high) {  
        high++;  
        return (int) (Math.random() * (high - low) + low);  
    }
	public static boolean searchIn(String Text,String Search){
		boolean erg = false;
		if (!Text.equalsIgnoreCase("")&!Search.equalsIgnoreCase("")){
			if (Text.length()>=Search.length()){
				for (int I=0;I+Search.length()<Text.length();I+=1){
					String Value = Text.substring(I, I+Search.length());
					if (Value.equals(Search)){
						erg=true;
					}
				}
				if (Text.substring(Text.length()-Search.length(),Text.length()).equals(Search)){
					erg=true;
				}
			}
		}
		return erg;
	}
	public static boolean isNewer(String newVersion,String oldVersion){
		boolean erg = false;
		boolean use = false;
		String[] n = newVersion.replace(".","//.//").split("//.//");
		String[] o = oldVersion.replace(".","//.//").split("//.//");
		for (int I=0;I<n.length;I++){
			if (I==n.length-1&n.length>o.length&use==false){
				erg=true;
			}
			if (use==false){
				try{
				if (Integer.valueOf(n[I])>Integer.valueOf(o[I])){
					erg=true;
					use=true;
				}
				if (Integer.valueOf(n[I])==Integer.valueOf(o[I])){
					use=false;
				}
				if (Integer.valueOf(n[I])<Integer.valueOf(o[I])){
					use=true;
				}}catch(Exception err){}
			}
		}
		if (newVersion.equals(oldVersion)){
			use=false;
		}
		return erg;
	}
	public static boolean isOlder(String newVersion,String oldVersion){
		boolean erg = false;
		boolean use = false;
		String[] n = newVersion.replace(".","//.//").split("//.//");
		String[] o = oldVersion.replace(".","//.//").split("//.//");
		for (int I=0;I<n.length;I++){
			if (I==n.length-1&n.length>o.length&use==false){
				erg=true;
			}
			if (use==false){
				try{
				if (Integer.valueOf(n[I])<Integer.valueOf(o[I])){
					erg=true;
					use=true;
				}
				if (Integer.valueOf(n[I])==Integer.valueOf(o[I])){
					use=false;
				}
				if (Integer.valueOf(n[I])>Integer.valueOf(o[I])){
					use=true;
				}}catch(Exception err){}
			}
		}
		return erg;
	}
}
